import java.util.Scanner;

public class StringDemo {
    public static void main(String[] args) {
        denglu();

    }

    private static void denglu() {
        Scanner sc = new Scanner(System.in);
        String username = "admin";
        String password = "123456";

        for (int i = 1; i <= 3; i++) {
            System.out.println("请输入用户名：");
            String inputusername = sc.nextLine();
            System.out.println("请输入密码：");
            String inputpassword = sc.nextLine();
            if (inputusername.equals(username) && inputpassword.equals(password)) {
                System.out.println("登录成功！");
                break;
            } else {
                if (i == 3) {
                    System.out.println("明天再来吧");
                } else {
                    System.out.println("登录失败！您还有" + (3 - i) + "次机会");
                }
            }
        }
    }
}
